//Created by Joanna Tan
Ext.define("MajorProjectSenchaTouch.view.SearchModule.ResultInfoDisplay",{
    extend: 'Ext.Panel',
    xtype: 'resultinfodisplay',
    requires: [
    'Ext.Label'
    ],
    config:{
          
        layout: [{
            type: 'hbox'
        }],
        items:[
        {
            xtype: 'panel',
            id: 'resultSortWrapper',
            items:[
            {
                xtype: 'panel',
                items: [{
                    xtype: 'label',
                    html:  '<div class="resultDspTitle">Search Result</div>'
                }]
            },
            {
                xtype: 'label',
                id: 'resultsummaryBtn'
            },
            {
                xtype: 'selectfield',
                id: 'resultsorterField',
                ui: 'light',
                usePicker: true,
                options: [
                {
                    text: 'Sort by: Year',
                    value: 'Year'
                },
                {
                    text: 'Sort by: Author',
                    value: 'Author'
                },
                {
                    text: 'Sort by: Title',
                    value: 'Title'
                },
                {
                    text: 'Sort by: Format',
                    value: 'Format'
                },
                {
                    text: 'Sort by: Shelf Number',
                    value: 'Callnum'
                }
                ],
/*
|--------------------------------------------------------------------------
| (@author : Joanna Tan)
|--------------------------------------------------------------------------
|
| When the picker value change it will call goSortResult in Search
| Controller to sort the results. 
|
*/
                listeners:{
                    change: function(select, newValue, oldValue){
                        var searchController = MajorProjectSenchaTouch.app.getController('Search');
                        searchController.goSortResult();
                    }
                }
            },
        ]
        }]
    }
});